package com.atguigu.gmall.feign.cart;

import com.atguigu.gmall.cart.entity.CartItem;
import com.atguigu.gmall.cart.vo.AddCartSuccessVo;
import com.atguigu.gmall.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author:ahang
 * @create:2022-10-19 14:42
 * @Description:
 */
@FeignClient("service-cart")
@RequestMapping("/api/inner/cart")
public interface CartFeignClient {

    /**
     * 添加购物车
     * @param skuId
     * @param skuNum
     * @return
     */
    @GetMapping("/add/{skuId}/{skuNum}")
    Result<AddCartSuccessVo> addToCart(@PathVariable("skuId") Long skuId,
                                       @PathVariable("skuNum") Integer skuNum);

    /**
     * 删除被选中的商品
     * @return
     */
    @GetMapping("/delete/checked")
    Result deleteChecked();

    /**
     * 返回购物车中被选中的商品集合
     * @return
     */
    @GetMapping("checked/items")
    Result<List<CartItem>> getCheckedCartItems();

}
